#import "CustomPin.h"

/**
 * A CustomPin is an object representing a pin on the map with a
 * custom image.
 *
 * @author      Justin Hollander
 * @version     0.9.3
 * @since       0.9.3
 */
@implementation CustomPin

@synthesize customPinImagePath;

/**
 * Initialize the custom pin with given information.
 *
 * @param annotation  the annotation for the pin
 * @param iPath       the file path to the pin's image
 * @return            the initialized custom pin with details
 */
- (id)initWithDetails:(id <MKAnnotation>) annotation imagePath:(NSString*)iPath
{
    self = [super initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
	
    if (self)        
    {
        UIImage* theImage = [UIImage imageWithContentsOfFile:iPath];
		
        if (!theImage)
			return nil;
		
        self.image = theImage;
    }    
    return self;
}


/*-(id) initWithCoder:(NSCoder*)decoder{
	if ((self = [super init]) && ([decoder allowsKeyedCoding]))  {		
		self.customPinImagePath = [decoder decodeObjectForKey:@"CustomPinImage"]; //get buildingname
		
	}
	
	return self;
}

-(void) encodeWithCoder:(NSCoder*)encoder{
	if ([encoder allowsKeyedCoding]) {
		[encoder encodeObject:self.customPinImagePath forKey:@"CustomPinImage"];
	}
}

/*-(NSString*) getKey{
	return self.customPinImagePath;
}*/

@end
